<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=device-width,initial-scale=1.0" />
		<meta charset="utf-8" />

		<script src="__PUBLIC__/Home/js/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="__PUBLIC__/Home/js/jquery.mobile-1.4.5.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="__PUBLIC__/Home/js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
		<script src="__PUBLIC__/Home/js/qrcode.js" type="text/javascript" charset="utf-8"></script>
		<!--<script src="__PUBLIC__/Home/js/index.js" type="text/javascript" charset="utf-8"></script>-->
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/Home/css/index.css"/>

		<link rel="stylesheet" type="text/css" href="__PUBLIC__/Home/css/font-awesome.css"/>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/Home/css/bootstrap.css"/>

		<link rel="stylesheet" type="text/css" href="__PUBLIC__/Home/css/weui.min.css"/>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/Home/css/weui.css"/>

		<title>瑜伽馆预约</title>
	</head>

	<body>

		<div data-role="page">
		  <div class="page">
			<div class="top">
				<a href=""><img src="__PUBLIC__/Home/img/home.png"/></a>
				<span>/</span>
				<a href="" class="sport">瑜伽馆课程</a>
			</div>
			<!---->
				<div class="jumbotron" style="padding:1em 0;background-color: #FFFFFF;">
	<span id="status" style="display:none"></span>
	<!--预约成功提示-->
	<div class="alert alert-dismissable alert-success" style="display:none;text-align:center;font-weight:600" id="alert">
	</div>

<php>
	if(I('time'))
	{
		$time = date("Y-m-d",strtotime(I('time')));
	}else
	{
		$time = date("Y-m-d",time());
	}
	$arr= getallweek($time);
	//$arr['8']['time'] = $arr['1']['time'];
	//$arr['8']['chw'] = $arr['1']['chw'];
	//unset($arr['1']);
	$nt = strtotime(I('time')?I('time'):date("Y-m-d",time()))+(7*86400);
	$yt = strtotime(I('time')?I('time'):date("Y-m-d",time()))-(7*86400);

		$ntime = date("Y-m-d",$nt);
		$ytime = date("Y-m-d",$yt);
</php>
<table class="table table-striped" style="width:100%;">
	<caption style="margin:0em 0">
		<div class="col-xs-4">
<a href="{:U('weekindex',array('time'=>date("Y-m-d",strtotime($ytime))))}" target="_top"  class="weui_btn weui_btn_plain_primary"style="width:3em ; border-radius : 1em"><span class="glyphicon glyphicon-chevron-left"></span></a>
		</div>
		<div class="col-xs-4" style="font-size:0.5em;text-align:center">
		周课表
		</div>
		<div class="col-xs-4">
		<a href="{:U('weekindex',array('time'=>date("Y-m-d",strtotime($ntime))))}" target="_top"  class="weui_btn weui_btn_plain_primary"style="width:3em ; border-radius : 1em"><span class="glyphicon glyphicon-chevron-right"></span></a></div>
	</caption>
	<tbody><tr><!--日期星期th-->
		<volist name="arr" id="v">

				<th style="background-color:#99ccff;font-size:0.8em;color:#333333;text-align:center;width:12%">
				{$v.time}<br>{$v.chw}
				</th>

			</if>

		</volist>



	</tr>

		<tr class="success"><!--早晨课表-->

			<volist name="res" id="r">
				<td style="font-size:0.8em;padding:0;height:5.5em;text-align:center;border:none;">

						<volist name="r" id="a">
							<php>$td = substr($a['course_time'],11,2);</php>
							<if condition="$td gt '0' AND $td lt '12'">
								<div class="panel panel-warning" style="padding:0;border-radius:none;background-color:{$a.color}">
								<div class="panel-body" style="height:11em;padding:0.5em 0;">
								<span style="font-size:1.2em;margin:0;color:green;padding:0.3em 0">{$a.course_time|substr="10"}</span><br>
								<span style="font-size:1em;">{$a.course_id|getcoursename}</span>
								<br>
								<span style="font-size:0.8em;">{$a.teacher_id|getteacher}</span><br>
								<span style="font-size:0.8em;">{$a.classroom_id|getClassroom}</span><br>
								<if condition="get_sy_class($a['course_id']) gt 0 ">

				<button type="button" class="btn btn-xs btn-success ui-btn ui-shadow ui-corner-all" data-toggle="modal" name="addWeek" class_id="{$a.course_id}" onclick="yuyue({$a.id})" style="width:3em;padding:0;">
															余{$a.course_id|get_sy_class}																			</button>
								</if>
								</div>
								</div>
							</if>

						</volist>
				</td>
			</volist>

		</tr>

		<tr class="danger" style="border-top:2px solid #FF6600"><!--下午课表-->
			<volist name="res" id="r">
				<td style="font-size:0.8em;padding:0;height:5.5em;text-align:center;border:none;">

						<volist name="r" id="a">
							<php>$td = substr($a['course_time'],11,2);</php>
							<if condition="$td egt '12' AND $td lt '18'">
								<div class="panel panel-warning" style="padding:0;border-radius:none;background-color:{$a.color}">
								<div class="panel-body" style="height:11em;padding:0.5em 0;">
								<span style="font-size:1.2em;margin:0;color:green;padding:0.3em 0">{$a.course_time|substr="10"}</span><br>
								<span style="font-size:1em;">{$a.course_id|getcoursename}</span>
								<br>
								<span style="font-size:0.8em;">{$a.teacher_id|getteacher}</span><br>
								<span style="font-size:0.8em;">{$a.classroom_id|getClassroom}</span><br>
								<if condition="get_sy_class($a['course_id']) gt 0 ">

									<button type="button" class="btn btn-xs btn-success ui-btn ui-shadow ui-corner-all" data-toggle="modal" name="addWeek" class_id="{$a.course_id}" onclick="yuyue({$a.id})" style="width:3em;padding:0;">
																							余{$a.course_id|get_sy_class}																			</button>
								</if>
								</div>
								</div>
							</if>

						</volist>
				</td>
			</volist>
		</tr>


		<tr class="info" style="border-top:2px solid #FF6600"><!--晚间课表-->
			<volist name="res" id="r">
				<td style="font-size:0.8em;padding:0;height:5.5em;text-align:center;border:none;">

						<volist name="r" id="a">
							<php>$td = substr($a['course_time'],11,2);</php>
							<if condition="$td egt '18' AND $td lt '24'">
								<div class="panel panel-warning" style="padding:0;border-radius:none;background-color:{$a.color}">
								<div class="panel-body" style="height:11em;padding:0.5em 0;">
								<span style="font-size:1.2em;margin:0;color:green;padding:0.3em 0">{$a.course_time|substr="10"}</span><br>
								<span style="font-size:1em;">{$a.course_id|getcoursename}</span>
								<br>
								<span style="font-size:0.8em;">{$a.teacher_id|getteacher}</span><br>
								<span style="font-size:0.8em;">{$a.classroom_id|getClassroom}</span><br>
								<if condition="get_sy_class($a['course_id']) gt 0 ">

									<button type="button" class="btn btn-xs btn-success ui-btn ui-shadow ui-corner-all" data-toggle="modal"  name="addWeek" class_id="{$a.course_id}" onclick="yuyue({$a.id})" style="width:3em;padding:0;">
																							余{$a.course_id|get_sy_class}																			</button>
								</if>

								</div>
								</div>
							</if>

						</volist>
				</td>
			</volist>
		</tr>
		</tbody></table>




<div class="btn-group btn-group-justified" style=";margin:0 auto 1em auto;">
  <a href="{:U('index')}" target="_top" class="btn btn-success">整日课表
  </a>
  <a href="{:U('quxiao')}"  target="_top" class="btn btn-warning">取消预约</a>
	<a data-toggle="modal" data-target="#myqrcode" onclick="$('#book_div1').toggle()" class="btn btn-info">二维码卡号</a>
  <!--<a data-toggle="modal" data-target="#myqrcode" class="btn btn-info">二维码卡号</a>-->
</div>

<br>
<div class="panel panel-success" style="margin:1em">
	<div class="panel-heading">
		<div class="panel-title">课程预约说明</div>
	</div>
	<div class="panel-body">
		<div>1、可限制每月最大爽约次数，超出则不能预约当月课程；<div>2、可限制取消预约的时间在课程开始前多少分钟，在此时间范围内，将不可以取消课程预约；</div><div>3、可以限制会员预约课程的时间，例如可限制只能预约三天内的课程；</div><div>4、可设置候补预约，当人数已满后，会员候补排队。</div></div>
	</div>
</div>

<!-- <div class="panel panel-success" style="margin:1em">
	<div class="panel-heading">
		<div class="panel-title">等级说明</div>
	</div>
	<div class="panel-body">
				<span>基础</span> : <span></span><br>
			</div>
</div> -->

<div class="modal" id="book_div1">
	<div class="modal-dialog">
		<div class="modal-content" id="erweicode" style="text-align: -webkit-center;">


		</div>
	</div>
</div>



<div class="modal" id="book_div">
  <div class="modal-dialog">
	<div class="modal-content">
	  <div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="font-size:2em">×</button>
		<h4 class="modal-title">请输入信息</h4>
	  </div>
	  <div class="modal-body">
		<form  action="{:U('add')}" class="form-horizontal" target="_top" method="post">

		<input type="hidden" name="id" id="bookClassid">
				<div class="input-group">
			<span class="input-group-addon">手机号码</span>
			<input type="tel" class="form-control" name="yueyu_tel" id="mobile" value="" placeholder="必填">
		</div>
		<br>
		<div class="input-group">
			<label class="input-group-addon">您的姓名</label>
			<input type="text" class="form-control" name="yueyu_name" id="userName" value="">
		</div>
		<br>
		<div class="input-group">
			<label class="input-group-addon">预约备注</label>
			<input type="text" class="form-control" name="yueyu_comment" id="bookNote">
		</div>
			  </form></div>
	  <div class="modal-footer">
		<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
		<button type="button" class="btn btn-success" id="bookButton" style="cursor:pointer">确认预约</button>
	  </div>

	</div>
  </div>
</div>



<style type="text/css">
	.panel-warning {
    border-radius: 0;
    margin-left: -1px;
    margin-right: -1px;
    margin-top: 0;
    margin-bottom: 0;
}
</style>


<script>
    $(document).ready(function () {
        var qrcode = new QRCode('erweicode', {
            text: "{$urlcode}",
            width: 256,
            height: 256,
            colorDark : '#000000',
            colorLight : '#ffffff',
            correctLevel : QRCode.CorrectLevel.H
        });

        $("#erweicode").children("img").css("margin","40px");

        $("#book_div1").click(function () {
            $(this).hide();
        })
    })
function yuyue(i) {
	$("#bookClassid").val("");
	$("#book_div").show();
	$("#bookClassid").val(i);
}
$(function(){

	$(".btn-default,.close").click(function() {
		$("#book_div").hide();
	})

	$("#bookButton").click(function() {
		$(".form-horizontal").submit();
	})
})
</script>


			<hr>










<script>
$(function(){

	$(document).on("click","#confirmSign",function(){
		mobile = $.trim($("#signMobile").val());
		if( mobile == ''){
			alert("请输入手机号码");
			$("#signMobile").focus();
		}else{
			obj = $.ajax({
				url:"http://bookonline.wendaosoft.com/bookonline/index.php/weiweb/company/everydaysign",
				type:"post",
				async:false,
				data:{
					customermobile : mobile,
					comid : $(this).attr("comid"),
				}
			})

			if(obj.responseText == "nocustomer"){
				alert("输入的手机号码没有对应的会员，请重试！");
				//$("#signMobile").val('').focus();
			}else if(obj.responseText == "existed"){
				alert("您今天已经签到，请勿重复签到！");
				//$("#signModal").hide();
			}else if(obj.responseText == 'ok'){
				alert("恭喜您签到成功！");
				//$("#signModal").hide();
			}

		}


	})
})
</script>




</div>
			<!---->
			<ul class="new">
				<?php foreach($data as $k=>$v):?>
				<a href="{:U('Home/Yuyue/detail?id='. $v['id'])}"><li>
				  <?php showImage($v['sm_logo'])?>
				  <div class="con">
				  	<h4>{:$v['course_name']}</h4>

				  </div>
				</li></a>
				<?php endforeach;?>
			</ul>


			  <include file="Common/main" />
		    </div>
		</div>



	</body>
</html>
